<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网上共青团·智慧团建</title>
   
</head>

<body>
                <div class="app-zhanghao">
                    <span class="fa fa-user " style="color:white"></span>
                    <input class="app-id" id="idcd" type="text" placeholder="身份证号码">
                </div>
                <div class="app-mima">
                    <span class="fa fa-lock" style="color:white"></span>
                    <input class="app-id" id="password" type="text" placeholder="密码">
                </div>
                <button class="btn-lg" id="app-sectionb" type="button">登录</button>
                <button class="btn-lg" id="zhuce" type="button">注册</button>
  <script src="./js/jquery-3.6.0.js"></script>
    <script>
        $('#app-sectionb').on('click',function(){
            let  idcd=$('#idcd').val().trim();
            let password=$('#password').val().trim()
      
            $.ajax({
            url:'/user/login',
            type:'get',
            data:{idcd,password},
            success:function(res){
                if(res.code===0){
                    setTimeout(function(){
                        location.href='./page/syy.html'
                    })
                    
                }else{
                    alert('登录失败了请从新登录好吗')
                }
                

            }
        })
        });
        //注册
        $('#zhuce').on('click',function(){
            let  idcd=$('#idcd').val().trim();
            let password=$('#password').val().trim()
      
            $.ajax({
            url:'/user/register',
            type:'post',
            data:{idcd,password},
            success:function(res){
                if(res.code===0){
                    console.log('注册成功');
                    setTimeout(function(){
                        location.href='./page/syy.html'
                    })
                    
                }else{
                    alert('注册失败')
                }
                

            }
        })
        });
       
       
    </script>
</body>

</html>